package com.lelv.business.travelAgency.action;

import java.util.ArrayList;
import java.util.List;

import com.lelv.business.travelAgency.bo.ITravelAgencyBo;
import com.lelv.business.travelAgency.model.TravelAgency;
import com.lelv.framework.action.BaseAction;
import com.lelv.framework.bo.IAdminBo;
import com.lelv.framework.model.Admin;
import com.lelv.framework.plugin.Page;

public class TravelAgencyAction extends BaseAction{

	private ITravelAgencyBo travelAgencyBo;
	private IAdminBo adminBo;
	private TravelAgency travelAgency;
	private Admin admin;
	private Page page = new Page();
	private List<TravelAgency> travelAgencys = new ArrayList<TravelAgency>();

	public String regTravelAgency(){

		this.travelAgencyBo.addTravelAgency(travelAgency);
		this.admin.setAdminLevel(1);
		this.admin.setTravelAgency(travelAgency);
		this.adminBo.addAdmin(admin);

		return "regOK";
	}

	public String deleteTravelAgency(){

		this.travelAgencyBo.deleteTravelAgency(travelAgency.getId());

		return SUCCESS;
	}

	public String getTravelAgencyPages(){

		this.page = this.travelAgencyBo.getTravelAgencyPage(page);
		this.travelAgencys = page.getList();

		return SUCCESS;
	}

	public ITravelAgencyBo getTravelAgencyBo() {
		return travelAgencyBo;
	}

	public void setTravelAgencyBo(ITravelAgencyBo travelAgencyBo) {
		this.travelAgencyBo = travelAgencyBo;
	}

	public IAdminBo getAdminBo() {
		return adminBo;
	}

	public void setAdminBo(IAdminBo adminBo) {
		this.adminBo = adminBo;
	}

	public TravelAgency getTravelAgency() {
		return travelAgency;
	}

	public void setTravelAgency(TravelAgency travelAgency) {
		this.travelAgency = travelAgency;
	}

	public Admin getAdmin() {
		return admin;
	}

	public void setAdmin(Admin admin) {
		this.admin = admin;
	}

	public Page getPage() {
		return page;
	}

	public void setPage(Page page) {
		this.page = page;
	}

	public List<TravelAgency> getTravelAgencys() {
		return travelAgencys;
	}

	public void setTravelAgencys(List<TravelAgency> travelAgencys) {
		this.travelAgencys = travelAgencys;
	}

}
